package com.sjl.db137.controller;

import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.sjl.db137.config.R;
import com.sjl.db137.entity.Userrole;
import com.sjl.db137.service.UserroleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version 1.0
 * @Author sjl
 * @date 2025/1/3 11:35
 * @Description
 */
@RestController
@CrossOrigin(origins = "*")
public class UserRoleController {
    @Autowired
    private UserroleService userroleService;

    @PostMapping("deleteByUseridAndRoleid")
    public R deleteByUseridAndRoleid(@RequestBody Userrole userrole) {
        UpdateWrapper<Userrole> userroleUpdateWrapper = new UpdateWrapper<>();
        userroleUpdateWrapper.setEntity(userrole);
        this.userroleService.remove(userroleUpdateWrapper);
//        System.out.println(userrole.getUserid()+"==="+userrole.getRoleid());
        return new R();
    }


}
